﻿<html lang="en">
<head> 
    <meta charset="utf-8"> 
    <meta name="viewport" content="width=device-width, initial-scale=1"> 
    <title>延安车务段站细管理系统</title>
<link href="/frontEnd/login/css/base.css" rel="stylesheet">
<link href="/frontEnd/login/css/login.css" rel="stylesheet">
</head> 
<body class="loginBody">
	<div class="left-bg"></div>
    <div class="right-bg"></div>
    <div class="login-logo"></div>
    <div class="login-center">
    	<div class="login-content">
    		<div class="notice">
    			<div class="notice-title">
    				<i class="notice-icon"></i>
    				<span>通知公告</span>
    			</div>
    			<ul class="notice-list" id="notice">
    			</ul>
    		</div>
			<form class="layui-form">
    		<div class="login-input">
    			<div class="login-label">用户登录</div>
    			<div class="username">
    				<i class="username-icon"></i>
    				<input type="text" placeholder="用户" name="loginname">
    			</div>
    			<div class="password">
    				<i class="password-icon"></i>
    				<input type="password" placeholder="密码" name="pwd">
    			</div>
			<!--	<button class="layui-btn layui-block" lay-filter="login" lay-submit>马上登录</button>-->
    			<div class="login-btn" lay-filter="login" lay-submit>马上登录</div>
    		</div>
			</form>
    	</div>
    </div>
</body>
</html>
<script type="text/javascript" src="/layuicms/js/cache.js"></script>
<script type="text/javascript" src="/layuicms/layui/layui.js"></script>
<script type="text/javascript">
    layui.use(['form','layer','jquery'],function(){
        var form = layui.form,
            layer = parent.layer === undefined ? layui.layer : top.layer
        $ = layui.jquery;
        //登录按钮
        form.on("submit(login)",function(data){
            var btn = $(this);
            //设置登录按钮为不可点击
            btn.text("登录中...").attr("disabled","disabled").addClass("layui-disabled");
            $.post("/login/login",data.field,function (rs) {
                //设置登录按钮恢复点击，在前端防止重复点击
                btn.text("登录").attr("disabled",false).removeClass("layui-disabled");
                if(rs.code!=20000){
                    layer.msg(rs.message);
                }else {
                    //跳转到templates/system/index/index.html页面
                    layer.msg(rs.message);
                    location.href="/sys/index";
                }
            })

            return false;
        })

        //表单输入效果
        $(".loginBody .input-item").click(function(e){
            e.stopPropagation();
            $(this).addClass("layui-input-focus").find(".layui-input").focus();
        })
        $(".loginBody .layui-form-item .layui-input").focus(function(){
            $(this).parent().addClass("layui-input-focus");
        })
        $(".loginBody .layui-form-item .layui-input").blur(function(){
            $(this).parent().removeClass("layui-input-focus");
            if($(this).val() != ''){
                $(this).parent().addClass("layui-input-active");
            }else{
                $(this).parent().removeClass("layui-input-active");
            }
        });
        $.get("/notice/loadNotice/",function (res) {
            var data = res.data;
            var dom=$("#notice");
            var html=''
            $.each(data,function(index,item){
                html+='<li class="list-item ellipsis"><i class="rt-icon"></i><a href="/notice/toNoticeDocument/'+item.id+'">'+item.title+'</a></li>'
            });
            dom.html(html);
        });
    })
</script>
